/*
 * @Author: 徐建辰
 * @Date: 2022-02-12 09:34:50
 * @LastEditTime: 2022-02-16 09:04:17
 * @LastEditors: 徐建辰
 * @Description: 路由表配置
 */
import {createRouter, createWebHashHistory} from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: () => import(/* webpackChunkName: "home" */ '@/views/home'),
      meta: {
        index: 1,
        tabbar: true,
        title: '首页',
        icon: 'home-o'
      }
    },
    {
      path: '/login',
      name: 'login',
      component: () => import(/* webpackChunkName: "login" */ '@/views/login'),
      meta: {
        index: 1,
        title: '登录'
      }
    },
    {
      path: '/category',
      name: 'category',
      component: () => import(/* webpackChunkName: "category" */ '@/views/category'),
      meta: {
        index: 1,
        tabbar: true,
        title: '分类',
        icon: 'apps-o'
      }
    },
    {
      path: '/shopcart',
      name: 'shopcart',
      component: () => import(/* webpackChunkName: "shopcart" */ '@/views/shopcart'),
      meta: {
        index: 1,
        tabbar: true,
        title: '购物车',
        icon: 'cart-o'
      }
    },
    {
      path: '/mine',
      name: 'mine',
      component: () => import(/* webpackChunkName: "mine" */ '@/views/mine'),
      meta: {
        index: 1,
        tabbar: true,
        title: '我的',
        icon: 'manager-o'
      }
    },
    {
      path: '/shoplist',
      name: 'shoplist',
      component: () => import(/* webpackChunkName: "shoplist" */ '@/views/category/shoplist'),
      meta: {
        index: 2,
        title: '产品列表'
      }
    },
    {
      path: '/shopdetail/:id',
      name: 'shopdetail',
      component: () => import(/* webpackChunkName: "shopdetail" */ '@/views/home/shopdetail'),
      meta: {
        title: '商品详情',
        index: 3
      }
    },
    {
      path: '/order',
      name: 'order',
      component: () => import(/* webpackChunkName: "order" */ '@/views/order'),
      meta: {
        title: '我的订单',
        index: 2
      }
    },
    {
      path: '/setting',
      name: 'setting',
      component: () => import(/* webpackChunkName: "setting" */ '@/views/mine/setting'),
      meta: {
        title: '账号管理',
        index: 2
      }
    },
    {
      path: '/address',
      name: 'address',
      component: () => import(/* webpackChunkName: "address" */ '@/views/mine/address'),
      meta: {
        title: '地址管理',
        index: 2
      }
    },
    {
      path: '/about',
      name: 'about',
      component: () => import(/* webpackChunkName: "about" */ '@/views/mine/about'),
      meta: {
        title: '关于我们',
        index: 2
      }
    },
    {
      path: '/addressEdit',
      name: 'addressEdit',
      component: () => import(/* webpackChunkName: "addressEdit" */ '@/views/mine/addressEdit'),
      meta: {
        title: '地址管理',
        index: 3
      }
    },
    {
      path: '/createOrder',
      name: 'createOrder',
      component: () => import(/* webpackChunkName: "createOrder" */ '@/views/order/createOrder'),
      meta: {
        title: '创建订单',
        index: 2
      }
    },
    {
      path: '/orderdetail',
      name: 'orderdetail',
      component: () => import(/* webpackChunkName: "orderdetail" */ '@/views/order/detail'),
      meta: {
        title: '订单详情',
        index: 3
      }
    },
    {
      path: '/404',
      name: '404',
      meta: {title: '404'},
      component: () => import('@/views/notfound')
    }
  ]
})

export default router
